﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ExcelImport.Validators
{
    public class PipelineContext
    {
        public PipelineContext(ImportTable importTable)
        {
            this._validationResults = new List<ValidationResult>();
            this.ImportTable = importTable;
        }
        public ImportTable ImportTable { get; }

        public ImporterOptions ImporterOptions { get; }

        private IList<ValidationResult> _validationResults { get; }

        public void AddValidationResult(ValidationResult validationResult)
        {
            if (_validationResults.Count < 10)
            {
                _validationResults.Add(validationResult);
            }
        }

        public IEnumerable<ValidationResult> GetValidationResults()
        {
            return new List<ValidationResult>(_validationResults);
        }

        public int Index { get; set; }

        public bool HasError
        {
            get
            {
                return this._validationResults.Count > 0;
            }
        }
    }
}
